#!/bin/bash
# bash compatibility-check.sh /path/to/build/root/dir
# check if java api version of .class is compatable with jdk8 
buildpath=$1
echo "buildpath is $1"
for class in $(find ${buildpath} -name "*.class" -type f)
do
  major_version=$(javap -verbose ${class} | grep "^  major version" | awk -F' ' '{print $3}')
  if ! [ ${major_version} -le 52 ];then
      echo "${class} major version is ${major_version}" >> check.log
  fi
done